Learning Objectives

After completing this lesson, you’ll be able to:

Video

Geographic Area of Interest

Some self-serve workspaces benefit from letting the user choose to download data within a geographic area of interest. There are three ways of doing so with FME:

Bounding Box

Letting the user define a bounding box is simple. Every reader can be restricted to only read features within a Search Envelope. The Minimum and Maximum X and Y parameters and the Search Envelope Coordinate System parameters can be published to give the user the ability to manually define a bounding box:

Search Envelope parameters

Note

While this approach is simple, it's not very user-friendly. It's a bit annoying to have to manually enter in bounding box coordinates. The method for using an ad hoc, user-submitted boundary drawn on a web map detailed below is more user-friendly.

Existing Boundary

You can give your readers the option to choose an existing boundary, like a county or a service area, and download the data within that area. There are several ways to accomplish this with FME, but the most effective is to use a WHERE Clause on the reader feature type combined with either a FeatureReader or a Clipper transformer.

WHERE Clause

Many reader feature types have the option to apply an SQL WHERE clause to the data before reading it into the workspace. For example, this reader feature type has a WHERE clause that means only garbage zones in the blue zone and the north subzone will be read:

Viewing a WHERE clause on a reader feature type

You can easily publish this WHERE Clause parameter to give users control over what existing boundary is used as the area of interest.

Creating a published parameter for the WHERE clause

Even better, you could create specific user parameters that are then used within a WHERE clause that is already written. That way the user doesn't need to know how to write a WHERE clause.

For example, you might create one Choice user parameter called Zone and one called Subzone and then include them in the WHERE Clause parameter through the WHERE Clause Builder:

Combining multiple published parameters in the WHERE clause

FeatureReader

Once you have set up a WHERE clause to let the user choose which boundaries to use, you then need to ensure they only receive their desired data within those boundaries. You can do this using a FeatureReader.

The polygon area of interest feature (or features) is routed into the FeatureReader Initiator port.

Here a single garbage schedule area (blue zone, north subzone) is passed to the FeatureReader for use as a filter. The idea is to return only addresses that fall inside that garbage collection zone. The parameters are set up like this:

Configuring FeatureReader

Notice that the FeatureReader is set to read from an address geodatabase. The Spatial Filter parameter tells the transformer to only read features (addresses) inside the incoming polygon feature (garbage collection zone).

These features are output through a port dynamically added to the FeatureReader:

Using the FeatureReader to filter the GarbageSchedule reader feature type

The feature counts here show that there are 955 addresses inside that garbage collection zone. The user can pick a zone and subzone and just receive the data from that area.

Ad Hoc Boundary

Note

FME 2020.0 and later have the Geometry parameter, a powerful new feature that lets FME Flow users interactively define their geographic area of interest. The parameter accepts a polygon in GeoJSON or FME XML format. To define it on Form, a user has to paste in GeoJSON or FME XML. To define it on FME Flow, they can interactively draw their area of interest on a web map.

To let users interactively draw their own area of interest, you can use the Geometry user parameter. In this example, we want to create a workspace where the construction company can draw on a map where they will be working. Then a 100m buffer surrounding their construction area will be set and notify the residents of the neighboring houses.

  1. We use a FeatureReader to read in the address points, and a Reprojector to put them into the UTM83-10 coordinate system.
  2. We create a Geometry published parameter that lets the user provide their area of interest.
  3. We then use that parameter to create geometry from GeoJSON using the GeometryReplacer.
  4. We use another Reprojector to make sure the area of interest matches the rest of the workspace.
  5. Then, we add a Bufferer to buffer 100m around the area of interest to capture addresses within the area affected by construction noise.
  6. After that, we use a Clipper to clip the source address data to the area of interest.
  7. At this point, the features have quite a few attributes the construction company won't need, so we employ an AttributeKeeper to keep only the necessary attributes.
  8. Finally, we add an Excel writer feature type to create a spreadsheet that can be used by the construction company to notify affected addresses.

Example workspace using the Geometry published parameter

When this workspace is run on FME Flow, the user can select their area of interest using an interactive web map:

Select Geometry parameter

Note

Previous versions of FME can accomplish this workflow, but they require using the FME Flow REST API and HTML/CSS/Javascript. You can view an example on our Knowledge Base.